home *** CD-ROM | disk | FTP | other *** search
- /*
- Copyright © 1991-1995 by TopSoft Inc. All rights reserved.
-
- You may distribute this file under the terms of the TopSoft
- Artistic License, accompanying this package.
-
- This file was developed by George (ty) Tempel in connection with TopSoft, Inc..
- See the Modification History for more details.
-
- Product
- About Box
-
- FILE
- ABox.h
-
- NAME
- ABox.h, part of the ABox project source code
- responsible for handling the AboutBox stuff.
-
- DESCRIPTION
- This file contains defines for the about box modules.
-
- DEVELOPED BY
- George (ty) Tempel netromancr@aol.com
- All code in this file, and its associated header file was
- Created by George (ty) Tempel in connection with the TopSoft, Inc.
- "FilterTop" application development, except where noted.
-
- CARETAKER - George (ty) Tempel <netromancr@aol.com>
- Please consult this person for any changes or suggestions to this file.
-
- MODIFICATION HISTORY
-
- dd mmm yy - xxx - patchxx: description of patch
- 10 June 94 - ty - Initial Version Created
- 20-july-94 - ty - initial version released
- 10-mar-95 - ty - 1.2 clean up edits for universal headers under CW5.5
- 23-may-95 - ty - changes for compatibility with the CodeWarrior CW6
- release and the associated Universal Headers from Apple:
- most methods that returned references now have "Ref" at
- the end of their methods names to prevent possible collisions
- with datatypes and classes of the same name (older versions
- of the compiler didn't have a problem with this).
- */
-
- /*===========================================================================*/
-
- /*========== Exclusion Macros ============*/
-
- #pragma once
-
- #ifndef _ABox_
- #define _ABox_
-
-
- /*============ Header Files ==============*/
-
-
-
- #include "ABObject.h"
- #include "ABTopicList.h"
-
- #include "ABUControls.h"
- #include "ABUTextBox.h"
- #include "ABUString.h"
- #include "ABUFonts.h"
-
- // if you define the SPEAK_ERROR symbol,
- // the abox will speak any error messages; if you
- // don't, it'll just beep it's little heart out.
-
- #define SPEAK_ERROR 1
-
- #if SPEAK_ERROR
- #include "ABUEnvSpeechSynth.h"
-
- #define ABERR(pascalString) { SysBeep(1); if (ABUEnvSpeechSynth::IsPresent()) SpeakString(pascalString);}
- #else
- #define ABERR(pascalString) SysBeep(1)
- #endif // SPEAK_ERROR
-
-
- /*=========== External Linkage ===========*/
-
- /*================ Macros ================*/
-
- /*============== Constants ===============*/
-
- #define kABoxWindow 'ABWn'
- #define kABoxWindowSize (sizeof(WindowPtr))
-
- #define kABoxHomeFolder 'ABhf'
- #define kABoxHomeFolderSize (sizeof(FSSpec))
-
- #define kABoxSplashTimeSeconds 'ABst'
- typedef long ABoxSplashTimeType;
- #define kABoxSplashTimeSecondsSize (sizeof(ABoxSplashTimeType))
- #define kABoxNoSplash (0)
- #define kABoxWaitForClickSplash (-1)
- #define kABoxWaitForApplicationSplash (-2)
-
- #define kABoxNumberOfTopics 'ABNt'
- #define kABoxNumberOfTopicsSize (sizeof(ABListCount))
-
- #define kABoxFirstTopicNumber 'ABft'
- #define kABoxFirstTopicNumberSize (sizeof(ABIndex))
-
- #define kABoxCurrentTopic 'ABct'
- #define kABoxCurrentTopicSize (sizeof(ABTopic))
-
- #define kABoxFirstSlideNumber 'ABfs'
- #define kABoxFirstSlideNumberSize (sizeof(ABIndex))
-
- #define kABoxAppResFile 'ABrf'
- #define kABoxAppResFileSize (sizeof(short))
-
- #define kABoxUpdater 'ABup'
- #define kABoxUpdaterSize (sizeof(UpdateWindowUPP))
-
- #define kABoxModalIndicator 'ABmi'
- typedef enum _ABoxModalIndicator
- {
- kABoxModal,
- kABoxMoveableModal,
- kABoxModeless
- } ABoxModalIndicator;
- #define kABoxModalIndicatorSize (sizeof(ABoxModalIndicator))
-
- #define kABoxAppNameAndVersion 'ABnv'
- #define kABoxAppNameAndVersionRefSize (sizeof(Str255))
-
- #define kABoxTextFont 'ABxf'
- typedef short ABoxTextFontType;
- #define kABoxTextFontSize (sizeof(ABoxTextFontType))
-
- #define kABoxTextSize 'ABxs'
- typedef short ABoxTextSizeType;
- #define kABoxTextSizeSize (sizeof(ABoxTextSizeType))
-
- #define kABoxTextFace 'ABxc'
- typedef short ABoxTextFaceType;
- #define kABoxTextFaceSize (sizeof(ABoxTextFaceType))
-
-
- #define kABoxLastEvent 'ABev'
- #define kABoxLastEventSize (sizeof(EventRecord))
-
-
- #define kABoxListHandle 'ABlh'
- #define kABoxListHandleSize (sizeof(ListHandle))
-
- #define kABoxWindowTitle 'ABti'
- #define kABoxWindowTitleSize (sizeof(Str255))
-
- #define kABoxThreadsHandler 'ABTh'
- #define kABoxThreadsHandlerSize (sizeof(DoThreadsUPP))
-
- #define kABoxInBackground 'ABbg'
- #define kABoxInBackgroundSize (sizeof(Boolean))
-
- #define kABoxIsFinished 'ABIf'
- #define kABoxIsFinishedSize (sizeof(Boolean))
-
- #define kABoxReportMemory 'ABrm'
- #define kABoxReportMemorySize (sizeof(Boolean))
-
- #define kABoxUseSpeechMgr 'ABsm'
- #define kABoxUseSpeechMgrSize (sizeof(Boolean))
-
- #define kABoxUseDragMgr 'ABdm'
- #define kABoxUseDragMgrSize (sizeof(Boolean))
-
- #define kABoxUseSoundMgr 'ABzm'
- #define kABoxUseSoundMgrSize (sizeof(Boolean))
-
-
- #define kAboutBoxWindowKind (5001)
-
- /*================ Enums =================*/
-
- /*=============== Structs ================*/
-
- /*=============== Typedefs ===============*/
-
- // d26 - ty
- // used for dispatching the update to another somebody...
- //
- // WindowUpdateProcPtr is a pointer to a function that can handle
- // Update events for a given window. This is useful, and indeed is
- // necessary, for handling the updating of other windows (not ours)
- // during ModalDialog event processing and Baloon Help.
- //
- typedef void (*WindowUpdateProcPtr)(WindowPtr window);
-
- #if GENERATINGCFM
- // powerpc stuff
- typedef UniversalProcPtr UpdateWindowUPP;
- #else
- typedef WindowUpdateProcPtr UpdateWindowUPP;
- #endif
-
- #define kABbadUpdateWindowUPP ((UpdateWindowUPP)NULL)
-
- // there is no RESULT_SIZE in the following UPP enumeration
- // since the WindowUpdateProcPtr is a void function
- enum {
- windowUpdateProcInfo = kCStackBased
- | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr)))
- };
-
- // if USEROUTINEDESCRIPTORS is defined by the environment then universal
- // proc ptr's will be generated in anticipation of possible PPC execution,
- // otherwise all of the following defines and typedefs become the good
- // old familiar 68k style information from pre-PowerMac days.
- //
- // CallWindowUpdateProc() is a macro used to invoke the WindowUpdateProcPtr
- // (UpdateWindowUPP) via univesral proc pointers.
- //
- // NewWindowUpdateProc() is a macro used to dynamically create a
- // universal WindowUpdateProcPtr (UpdateWindowUPP)
- //
- #if GENERATINGCFM
- // powerpc stuff
- #define NewWindowUpdateProc(userRoutine) \
- (UpdateWindowUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), windowUpdateProcInfo, GetCurrentISA())
-
- #else // not using the universal PPC style proc pointers
-
- #define NewWindowUpdateProc(userRoutine) \
- (UpdateWindowUPP)(userRoutine)
-
- #endif // GENERATINGCFM
-
-
- #if GENERATINGCFM
- #define CallWindowUpdateProc(userRoutine, windowPtr) \
- CallUniversalProc((UniversalProcPtr)(userRoutine), windowUpdateProcInfo, (windowPtr))
-
- #else // not using the universal PPC style proc pointers
-
- #define CallWindowUpdateProc(userRoutine, windowPtr) \
- (*(userRoutine))((windowPtr))
- #endif // GENERATINGCFM
-
-
- //=============
-
- // used for yielding time to other threads...
- //
- // DoThreadsProcPtr is a pointer to a Pascal-style parameter-less function
- // that returns a type of OSErr. It will be used as a means to
- // handle yielding time to other threads, whether via the thread mgr or
- // the older and not-really-supported threads pkg.
- //
- typedef pascal OSErr (*DoThreadsProcPtr)(void);
-
- #if GENERATINGCFM
- typedef UniversalProcPtr DoThreadsUPP;
- #else // not using the universal PPC style proc pointers
-
- typedef DoThreadsProcPtr DoThreadsUPP;
-
- #endif // GENERATINGCFM
-
- // there is no RESULT_SIZE in the following UPP enumeration
- // since the DoThreadsProcPtr is a void function
- //
- // there are no parameters in the following UPP enumeration since
- // the DoThreadsProcPtr has none.
- enum {
- doThreadsProcPtrInfo = kPascalStackBased
- | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
- };
-
- // if GENERATINGCFM is defined by the environment then universal
- // proc ptr's will be generated in anticipation of possible PPC execution,
- // otherwise all of the following defines and typedefs become the good
- // old familiar 68k style information from pre-PowerMac days.
- //
- // CallDoThreadsUpdateProc() is a macro used to invoke the DoThreadsProcPtr
- // via univesral proc pointers.
- //
- // NewDoThreadsProc() is a macro used to dynamically create a
- // universal DoThreadsProcPtr
- //
- #if GENERATINGCFM
- #define NewDoThreadsProc(userRoutine) \
- (UpdateWindowUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), doThreadsProcPtrInfo, GetCurrentISA())
-
- #else // not using the universal PPC style proc pointers
-
- #define NewDoThreadsProc(userRoutine) \
- (DoThreadsUPP)(userRoutine)
-
- #endif // GENERATINGCFM
-
- #if GENERATINGCFM
- #define CallDoThreadsUpdateProc(userRoutine) \
- CallUniversalProc((UniversalProcPtr)(userRoutine), doThreadsProcPtrInfo)
-
- #else // not using the universal PPC style proc pointers
-
- #define CallDoThreadsUpdateProc(userRoutine) \
- (*(userRoutine))()
-
- #endif // GENERATINGCFM
-
-
-
- /*=========== Class Definitions ==========*/
-
- #define kABoxSuperProperty ABObject
- class ABox : public ABObject,
- ABUControls
- #ifdef SPEAK_ERROR
- , ABUEnvSpeechSynth
- #endif // SPEAK_ERROR
- {
- public:
- ABox(void);
- virtual ~ABox(void);
-
- OSErr GetProperty (ABProperty prop, void *ptr, long *ptrSize);
- OSErr SetProperty (ABProperty prop, void *ptr, long ptrSize);
-
- OSErr Draw(WindowPtr window);
- OSErr Update(WindowPtr window);
- Boolean Event(EventRecord *event);
- OSErr Stop(void);
- OSErr Close(void);
-
- GrafPtr GetWindow(void) const { return this->OurWindowRef(); }
-
- Boolean IsInBackground(void) const { return this->InBackgroundFlagRef() == true; }
- Boolean IsInForeground(void) const { return ! this->IsInBackground(); }
-
- Boolean HasWindowNameRef(void) const { return this->WindowNameRef() != NULL; }
- Boolean DoesntHaveWindowNameRef(void) const { return ! this->HasWindowNameRef(); }
-
- Boolean IsWindowUp(void) const { return this->WindowUpFlagRef() == true; }
- Boolean WindowIsUp(void) const { return this->IsWindowUp(); }
- Boolean WindowIsntUp(void) const { return ! this->WindowIsUp(); }
-
- Boolean IsModal(void) const { return this->ModalIndicatorRef() == kABoxModal; }
- Boolean IsMoveableModal(void) const { return this->ModalIndicatorRef() == kABoxMoveableModal; }
- Boolean IsModeless(void) const { return this->ModalIndicatorRef() == kABoxModeless; }
-
- Boolean IsNotSplashScreen(void) const { return this->SplashTimeRef() == kABoxNoSplash; }
- Boolean IsClickSplash(void) const { return this->SplashTimeRef() == kABoxWaitForClickSplash; }
- Boolean IsApplicationSplash(void) const { return this->SplashTimeRef() == kABoxWaitForApplicationSplash; }
- Boolean IsSplashScreen(void) const { return ! this->IsNotSplashScreen(); }
-
- protected:
- static pascal void DrawDialogItem(DialogPtr dialog, short itemNo);
- static pascal Boolean ModalEventFilter(DialogPtr dialog, EventRecord *event, short *item);
-
- OSErr ToForeground(void);
- OSErr ToBackground(void);
-
- OSErr ChangeControls(void);
- OSErr BuildABox (void);
- OSErr CreateAndFillTopicList (void);
- OSErr ProcessItemHit (EventRecord *eventRec, short itemNo);
- Boolean Splash (EventRecord *eventRec);
- Boolean HandleEvent (EventRecord *eventRec, short itemNo);
- OSErr DoThreads(void);
-
- void ReportMemory(void);
-
- private:
- // these elements are caller available properties...
- FSSpecPtr mHomeFolder;
- ABIndex mFirstTopic;
- ABIndex mFirstSlide;
- long mSplashTime;
- short mCallerResFile;
- UpdateWindowUPP mUpdater;
- ABoxModalIndicator mModalIndicator;
- StringPtr mAppNameAndVersionRef;
- StringPtr mWindowName;
- short mTextFont;
- short mTextSize;
- short mTextFace;
- ListHandle mListHandle;
- EventRecord mLastEvent;
- Boolean mInBackgroundFlag;
- DoThreadsUPP mThreadsHandler;
- Boolean mReportMemoryFlag;
- Boolean mUseSpeechMgrFlag;
- Boolean mUseSoundMgrFlag;
- Boolean mUseDragMgrFlag;
-
- // these elements are strictly internal items...
- short mDialogID;
- ABTopicList* mTopics;
- ABUEnv* mThreadsInfo;
- Boolean mWindowUpFlag;
- ModalFilterUPP mModalUPP;
-
- FSSpecPtr& HomeFolderRef(void) const { return this->mHomeFolder; }
- ABIndex& FirstTopicRef(void) const { return this->mFirstTopic; }
- ABIndex& FirstSlideRef(void) const { return this->mFirstSlide; }
- long& SplashTimeRef(void) const { return this->mSplashTime; }
- short& CallerResFileRef(void) const { return this->mCallerResFile; }
- UpdateWindowUPP& UpdaterRef(void) const { return this->mUpdater; }
- ABoxModalIndicator& ModalIndicatorRef(void) const { return this->mModalIndicator; }
- StringPtr& AppNameAndVersionRef(void) const { return this->mAppNameAndVersionRef; }
- StringPtr& WindowNameRef(void) const { return this->mWindowName; }
- short& TextFaceRef(void) const { return this->mTextFace; }
- short& TextFontRef(void) const { return this->mTextFont; }
- short& TextSizeRef(void) const { return this->mTextSize; }
- ListHandle& ListHandleRef(void) const { return this->mListHandle; }
- EventRecord& LastEventRef(void) const { return this->mLastEvent; }
- Boolean& InBackgroundFlagRef(void) const { return this->mInBackgroundFlag; }
- DoThreadsUPP& ThreadsHandlerRef(void) const { return this->mThreadsHandler; }
- Boolean& ReportMemoryFlagRef(void) const { return this->mReportMemoryFlag; }
- Boolean& UseSpeechMgrFlagRef(void) const { return this->mUseSpeechMgrFlag; }
- Boolean& UseSoundMgrFlagRef(void) const { return this->mUseSoundMgrFlag; }
- Boolean& UseDragMgrFlagRef(void) const { return this->mUseDragMgrFlag; }
-
- short& DialogIDRef(void) const { return this->mDialogID; }
- ABTopicList*& TopicsRef(void) const { return this->mTopics; }
- GrafPtr& WindowRef(void) const { return this->OurWindowRef(); }
- ABUEnv*& ThreadsInfoRef(void) const { return this->mThreadsInfo; }
- Boolean& WindowUpFlagRef(void) const { return this->mWindowUpFlag; }
- ModalFilterUPP& ModalUPPRef(void) const { return this->mModalUPP; }
-
-
- };
-
-
- /*========== Function Prototypes =========*/
-
-
- #endif // _ABox_
-
-